MFQ20 <- read.table(file.choose(), header = TRUE)

MFQ20$Party.cat <- NA
MFQ20$Party.cat[MFQ20$Party <= 3] <- "Democrat"
MFQ20$Party.cat[MFQ20$Party == 4] <- "Independent"
MFQ20$Party.cat[MFQ20$Party >= 5] <- "Republican"

MFQ20$Ideol.cat <- NA
MFQ20$Ideol.cat[MFQ20$Ideol <= 3] <- "Liberal"
MFQ20$Ideol.cat[MFQ20$Ideol == 4] <- "Moderate"
MFQ20$Ideol.cat[MFQ20$Ideol >= 5] <- "Conservative"

# Measures for Appendix #
MFQ20$HarmTotal.2 <- ((MFQ20$Harm1 + MFQ20$Harm2 + MFQ20$Harm3 + 
                         MFQ20$Harm4) - 4)/20
MFQ20$FairTotal.2 <- ((MFQ20$Fair1 + MFQ20$Fair2 + MFQ20$Fair3 + 
                         MFQ20$Fair4) - 4)/20
MFQ20$IngroupTotal.2 <- ((MFQ20$Ingroup1 + MFQ20$Ingroup2 + MFQ20$Ingroup3 +
                            MFQ20$Ingroup4) - 4)/20
MFQ20$AuthTotal.2 <- ((MFQ20$Auth1 + MFQ20$Auth2 + MFQ20$Auth3 + 
                         MFQ20$Auth4) - 4)/20
MFQ20$PureTotal.2 <- ((MFQ20$Pure1 + MFQ20$Pure2 + MFQ20$Pure3 +
                         MFQ20$Pure4) - 4)/20

library(VGAM)

# Dems First #
MFQ20.D <- subset(MFQ20, Party.cat == "Democrat")

Tobit2.Harm.D <- vglm(HarmTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Ideol"), 
                      tobit(Upper = 1, Lower = 0), 
                      data = MFQ20.D)
summary(Tobit2.Harm.D)

Tobit2.Fair.D <- vglm(FairTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Ideol"), 
                      tobit(Upper = 1, Lower = 0), 
                      data = MFQ20.D)
summary(Tobit2.Fair.D)

Tobit2.Ingroup.D <- vglm(IngroupTotal.2 ~ Treatment, 
                         subset = c(Treatment != "Ideol"), 
                         tobit(Upper = 1, Lower = 0), 
                         data = MFQ20.D)
summary(Tobit2.Ingroup.D)

Tobit2.Auth.D <- vglm(AuthTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Ideol"), 
                      tobit(Upper = 1, Lower = 0), 
                      data = MFQ20.D)
summary(Tobit2.Auth.D)

Tobit2.Pure.D <- vglm(PureTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Ideol"), 
                      tobit(Upper = 1, Lower = 0), 
                      data = MFQ20.D)
summary(Tobit2.Pure.D)


# Republicans #
MFQ20.R <- subset(MFQ20, Party.cat == "Republican")

Tobit2.Harm.R <- vglm(HarmTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Ideol"), 
                      tobit(Lower = 0, Upper = 1), 
                      data = MFQ20.R)
summary(Tobit2.Harm.R)

Tobit2.Fair.R <- vglm(FairTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Ideol"), 
                      tobit(Upper = 1, Lower = 0), 
                      data = MFQ20.R)
summary(Tobit2.Fair.R)

Tobit2.Ingroup.R <- vglm(IngroupTotal.2 ~ Treatment, 
                         subset = c(Treatment != "Ideol"), 
                         tobit(Upper = 1, Lower = 0), 
                         data = MFQ20.R)
summary(Tobit2.Ingroup.R)

Tobit2.Auth.R <- vglm(AuthTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Ideol"), 
                      tobit(Upper = 1, Lower = 0), 
                      data = MFQ20.R)
summary(Tobit2.Auth.R)

Tobit2.Pure.R <- vglm(PureTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Ideol"), 
                      tobit(Upper = 1, Lower = 0), 
                      data = MFQ20.R)
summary(Tobit2.Pure.R)


# Liberals
MFQ20.L <- subset(MFQ20, Ideol.cat == "Liberal")

Tobit2.Harm.L <- vglm(HarmTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Party"), 
                      tobit(Upper = 1, Lower = 0), 
                      data = MFQ20.L)
summary(Tobit2.Harm.L)

Tobit2.Fair.L <- vglm(FairTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Party"), 
                      tobit(Upper = 1, Lower = 0), 
                      data = MFQ20.L)
summary(Tobit2.Fair.L)

Tobit2.Ingroup.L <- vglm(IngroupTotal.2 ~ Treatment, 
                         subset = c(Treatment != "Party"), 
                         tobit(Upper = 1, Lower = 0), 
                         data = MFQ20.L)
summary(Tobit2.Ingroup.L)

Tobit2.Auth.L <- vglm(AuthTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Party"), 
                      tobit(Upper = 1, Lower = 0), 
                      data = MFQ20.L)
summary(Tobit2.Auth.L)

Tobit2.Pure.L <- vglm(PureTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Party"), 
                      tobit(Upper = 1, Lower = 0), 
                      data = MFQ20.L)
summary(Tobit2.Pure.L)


# Conservatives #
MFQ20.C <- subset(MFQ20, Ideol.cat == "Conservative")

Tobit2.Harm.C <- vglm(HarmTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Party"), 
                      tobit(Upper = 1, Lower = 0), 
                      data = MFQ20.C)
summary(Tobit2.Harm.C)

Tobit2.Fair.C <- vglm(FairTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Party"), 
                      tobit(Upper = 1, Lower = 0), 
                      data = MFQ20.C)
summary(Tobit2.Fair.C)

Tobit2.Ingroup.C <- vglm(IngroupTotal.2 ~ Treatment, 
                         subset = c(Treatment != "Party"), 
                         tobit(Upper = 1, Lower = 0), 
                         data = MFQ20.C)
summary(Tobit2.Ingroup.C)

Tobit2.Auth.C <- vglm(AuthTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Party"), 
                      tobit(Upper = 1, Lower = 0), 
                      data = MFQ20.C)
summary(Tobit2.Auth.C)

Tobit2.Pure.C <- vglm(PureTotal.2 ~ Treatment, 
                      subset = c(Treatment != "Party"), 
                      tobit(Upper = 1, Lower = 0), 
                      data = MFQ20.C)
summary(Tobit2.Pure.C)